//
//  ShapeFactory.swift
//  SimpleFactoryPatern
//
//  Created by 好米有易 on 2017/9/27.
//  Copyright © 2017年 好米有易. All rights reserved.
//

import UIKit

enum ShapeType {
    case rectangle
    case squre
    case circle
}

class ShapeFactory: NSObject {

    public class func shap(type: ShapeType) -> Shape {
        
        if type ==  ShapeType.rectangle {
            
            return Rectangle()
        }
        
        if type == ShapeType.squre {
            return Square()
        }
        
        if type == ShapeType.circle {
            
            return Circle()
        }
        
        return Rectangle()
        
    }
    
}
